from django.conf.urls.defaults import *
from django.contrib.auth.models import User

from popboard.feeds import LatestPosts, LatestThreadPosts, LatestCategoryPosts

feeds = {
    'latest': LatestPosts,
    "thread": LatestThreadPosts,
    "category": LatestCategoryPosts
}

urlpatterns = patterns('popboard.views',
    url(r'^$', 'category_list', name='popboard-index'),
    url(r'^profile/$', 'edit_profile', name='popboard-edit-profile'),
    url(r'^newtopic/(?P<cat_id>\d+)/$', 'new_thread', name='popboard-new-thread'),
    url(r'^categories/$', 'category_list', name='popboard-category-list'),
    url(r'^watched/$', 'watched_list', name='popboard-watched-list'),
    url(r'^threads/$', 'recent_threads', name='popboard-thread-index'),
    url(r'^posts/$', 'recent_posts', name='popboard-post-index'),
    url(r'^threads/id/(?P<thread_id>\d+)/$', 'thread', name='popboard-thread'),
    url(r'^threads/id/(?P<thread_id>\d+)/watch/$', 'thread_watch', name='popboard-thread-watch'),
    url(r'^threads/id/(?P<thread_id>\d+)/sticky/$', 'thread_sticky', name='popboard-thread-sticky'),
    url(r'^threads/id/(?P<thread_id>\d+)/close/$', 'thread_status', name='popboard-thread-status'),
    url(r'^threads/category/(?P<cat_id>\d+)/$', 'thread_category_index', name='popboard-thread-category-index'),
    url(r'^accounts/profile/$', 'view_profile', name='popboard-user-profile'),
    url(r'^user/(?P<thread_id>\d+)/$', 'view_profile', name='popboard-user-profile'),
)

urlpatterns += patterns('',
    url(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}, name="popboard-feed"),
)